package protoutils

import (
	"strings"
)

// const
const (
	ProtoTagName = "protobuf"
)

// GetProtoKey 获取key
func GetProtoKey(tag string) (key string) {
	for len(tag) > 0 {
		i := strings.IndexByte(tag, ',')
		if i < 0 {
			i = len(tag)
		}
		switch s := tag[:i]; {
		case strings.HasPrefix(s, "name="):
			key = s[len("name="):]
		default:

		}
		tag = strings.TrimPrefix(tag[i:], ",")
	}
	return
}
